package by.myteam.gonki.bo.car;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

import by.myteam.gonki.bo.CoordinatesObject;
import by.myteam.gonki.bo.IDrawable;
import by.myteam.gonki.bo.Road;

public class SilverCar extends CoordinatesObject implements IDrawable,ICarObject {

	private final String CAR_PNG = "graph/silver_car.png";
	private final int START_POSITION_X = 100;
	private final int START_POSITION_Y = 375;
	private final int CAR_WIDTH = 200;
	private final int CAR_HEIGHT = 105;
	private final int MAX_SPEED = 50;
	private final String NAME_CAR = "Silver Car";
	private final Integer health = 90;
	private final Image image = Toolkit.getDefaultToolkit().getImage(CAR_PNG);
	
	public static SilverCar INSTANCE = new SilverCar();

	private SilverCar() {
		this.setY(START_POSITION_Y);;
		this.setX(START_POSITION_X);
	}
	
	@Override
	public void setY(int y){
		if((y >= Road.INSTANCE.getTopBorder() || y <= Road.INSTANCE.getBottomBorder())) return;
		else super.setY(y);	
	}

	@Override
	public void draw(Graphics g) {

		g.drawImage(image, getX(), getY(), CAR_WIDTH, CAR_HEIGHT, null);
		//System.out.println(getY());
	}

	public int getMaxSpeed() {
		return MAX_SPEED;
	}

	@Override
	public String nameCar() {
		return NAME_CAR;
	}
	
	@Override
	public int getCarWidth() {
		return CAR_WIDTH;
	}

	@Override
	public int getCarHeigth() {
		return CAR_HEIGHT;
	}
	
	public Integer getHealth() {
		return health;
	}

	@Override
	public void reset(){
		INSTANCE = new SilverCar();
		/*this.setY(START_POSITION_Y);
		this.setX(START_POSITION_X);*/
	}

}
